Skip to content

Pass Mago 1.59 format, lint and analyze checks - #245

Merged
simon-mundy merged 1 commit into
php-db:0.6.xfrom
simon-mundy:qa/mago-1.59
Nov 3, 2026
Merged

simon-mundy merged 1 commit into
php-db:0.6.xfrom
simon-mundy:qa/mago-1.59

Conversation

@simon-mundy

Copy link
Copy Markdown
Member

Problem

0.6.x has failed the Mago and mutation-test jobs since the merge of #234 on 27 Oct. The code didn't change: CI installs the latest Mago, which is now 1.59.0. Under 1.57 the branch is clean. Under 1.59:

  • mago format --check wants Update::processSet() reformatted.
  • mago analyze reports 10 errors in Pdo\Statement, AbstractPlatform and AbstractRowGateway. The Statement and platform findings were already baselined, but 1.59 reworded their messages so the baseline stopped matching.

Mutation testing fails at the same point, because Infection runs mago analyze before mutating. Any PR that updates against 0.6.x (for example #235) inherits all of this.

Fix

  • Pdo\Statement: execute() and bindParametersFromContainer() read the PDO statement through a new private getPreparedResource(): PDOStatement guard instead of calling execute(), errorInfo() and bindParam() on PDOStatement|false|null. An unprepared resource throws the new Adapter\Exception\RuntimeException::forUnpreparedStatement() instead of failing on a call to null or false. Two tests cover the guard, one through execute() and one through parameter binding.
  • AbstractPlatform::getTypeDecorator(): the loop variable is typed PlatformDecoratorInterface inline. The $decorators property keeps its plain array type because Platform stores nested arrays in it.
  • AbstractRowGateway: its six mixed-array-index findings are baselined rather than fixed, because Bring TableGateway and RowGateway to Mago compliance #233 rewrites that class for Mago compliance and a fix here would only conflict with it.
  • Update.php: reformatted.
  • Baselines: both regenerated under 1.59.0, which also removes about 20 stale entries.

Checks (local, Mago 1.59.0)

  • mago format --check, lint, analyze and guard pass for PHP 8.3, 8.4 and 8.5.
  • PHPUnit: 2,188 tests pass.
  • Infection on the changed files: all mutants in the new code are killed. The 7 that escape are in Update.php code this PR doesn't change.

The regenerated baseline drops entries worded the 1.57 way, so this belongs with php-db/phpdb-qa-tools#8, which pins CI to Mago 1.59.0. They can merge in either order because CI already installs 1.59.0.

CI installs the latest Mago release, and 1.59.0 fails 0.6.x: one file
needs reformatting and analyze reports ten errors that the baseline no
longer matches.

Pdo\Statement now reads its PDOStatement through a private
getPreparedResource() guard instead of calling execute(), errorInfo()
and bindParam() on a resource typed PDOStatement|false|null. An
unprepared resource throws the new
Adapter\Exception\RuntimeException::forUnpreparedStatement() rather
than failing on a call to null or false.

AbstractPlatform::getTypeDecorator() types its loop variable as
PlatformDecoratorInterface. The property keeps its plain array type
because Platform stores nested arrays in it.

The six AbstractRowGateway findings are baselined, since php-db#233
rewrites that class for Mago compliance. Both baselines are regenerated
under 1.59.0, which also drops the entries that no longer match.
@codecov

codecov Bot commented Nov 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@simon-mundy simon-mundy self-assigned this Nov 3, 2026
@simon-mundy
simon-mundy requested a review from tyrsson November 3, 2026 23:51
@simon-mundy simon-mundy added the bug Something isn't working label Nov 3, 2026
@github-project-automation github-project-automation Bot moved this to Todo in @phpdb Nov 3, 2026
@simon-mundy simon-mundy added this to the 0.6.0 milestone Nov 3, 2026
@github-project-automation github-project-automation Bot moved this from Todo to In Progress in @phpdb Nov 3, 2026
@simon-mundy
simon-mundy merged commit 24277bc into php-db:0.6.x Nov 3, 2026
15 checks passed
@github-project-automation github-project-automation Bot moved this from In Progress to Done in @phpdb Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants